package jc223504;
/**
 * @(#)KookWai_A1.java
 *
 * KookWai_A1 application
 *
 * @Lock Kook Wai
 * @version 1.00 2011/3/24
 */

import java.util.Random;

public class Car
{

    private int xPos;
    private int yPos;
    Random random = new Random();


    public Car() // empty constuctor for default settings
    {
    	xPos = 0;
    	yPos = 0;
    }

   public Car(int x, int y)
    {
    	xPos = 0;
    	yPos = 0;
    }


    public int getXPos()
    {
    	return xPos;
    }

    public int getYPos()
    {
    	return yPos;
    }

    public void setXPos(int x)
    {
    	this.xPos = x;
    }
    public void setYPos(int y)
    {
    	this.yPos = y;
    }

     /**
     * Random Generator number for cars
     */

    public int GenerateCarRandNum()
    {
    	int num = 1+ random.nextInt(9);
    	return num;
    }

     /**
     * Set random cars on X position
     */

    public int GenerateRandCarXPos(int gridSize)
    {
    	int num = 1 + random.nextInt((gridSize-1));
    	return num;
    }

    /**
     * Set random cars on Y position
     */

    public int GenerateRandCarYPos(int lane, int middle)
    {
    	int num = middle + random.nextInt(lane);
    	return num;
    }



}
